import scrapy
from scrapy.mail import MailSender


class HttpbinSpider(scrapy.Spider):
    name = "httpbin"

    # start_urls = ["http://httpbin.org/get?age=100" for i in range(10)]
    async def start(self):
        for url in ["http://httpbin.org/get?age=10" for i in range(1)]:
            # dont_filter 不过滤 默认为False  重写start函数自带过滤
            yield scrapy.Request(url)

    def parse(self, response):
        print(response.json())
        mail = MailSender(smtphost='smtp.163.com',
                          mailfrom='15225989853@163.com',
                          smtpuser='15225989853@163.com',
                          smtppass='LVbtw7ejYDJeNPvA',
                          smtpport=465,
                          smtpssl=True)
        return mail.send(to=['2094729537@qq.com', ], subject='111111', body='123456789')
